#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include "regex.h"

#define OVECCOUNT 30

pcre *compile_regex(char *pattern)
{

	pcre *pcre;
	const char *error;
	int erroffset;

	pcre = pcre_compile(
			pattern, 
			0,
			&error,
			&erroffset,
			NULL);

	if (! pcre)
	{
  		printf("PCRE compilation failed at offset %d: %s\n", erroffset, error);
	}

	return pcre;

}
//////////////////////////////////////////////////////////////////
int is_regex_match(pcre *regex, int *ovector, char *logline)
{
		
 
	return pcre_exec(
			regex,
			NULL,
			logline,
			(int)strlen(logline),
			0,
			0,
			ovector,
			OVECCOUNT);

} 

